<%@page import="com.nescafe.nescafepromo.entity.Participant"%>
<%@page import="java.util.List"%>
<%@page import="com.nescafe.nescafepromo.model.NPResponse"%>
<%@page import="com.nescafe.nescafepromo.controller.AdminController"%>
<%@page import="com.nescafe.nescafepromo.command.CommandType"%>
<%@page import="com.nescafe.nescafepromo.model.NPRequest"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	NPRequest npReq = new NPRequest(request, CommandType.SEARCH_PARTICIPANTS);
	if (!request.getParameterMap().containsKey("email")) {
		npReq.addParam("email", null);
	}

	AdminController ctr = new AdminController();
	NPResponse npRes = ctr.process(npReq);
	List<Participant> result = npRes.getParticipantDetailList().getSortedList();
%>

<div class="table-container">
	<table border="1" cellpadding="5px">
		<tr>
			<th>Facebook ID</th>
			<th>Name</th>
			<th>Email</th>
			<th>Location</th>
			<th>Points</th>
		</tr>
		<%
			for (Participant participant : result) {
		%>
		<tr>
			<td><%=participant.getDisplayFBID()%></td>
			<td><%=participant.getDisplayName()%></td>
			<td><%=participant.getEmail()%></td>
			<td><%=participant.getDisplayLocation() %></td>
			<td><%=participant.getDisplayTotalPoints()%></td>
		</tr>
		<%
			}
		%>


		<!-- 
		<tr>
			<td>103030030344</td>
			<td>Juan Dela Cruz</td>
			<td>juan@yahoo.com</td>
			<td>Manila</td>
			<td>20,000</td>
		</tr>
		<tr>
			<td>10301525</td>
			<td>Will Smith</td>
			<td>will@yahoo.com</td>
			<td>Ontario, Canada</td>
			<td>300</td>
		</tr>
		<tr>
			<td>23698262656</td>
			<td>Danny Dough</td>
			<td>danny@yahoo.com</td>
			<td>Toronto, Canada</td>
			<td>4,000</td>
		</tr> -->
	</table>

</div>
